package com.weishi.project.training.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.weishi.project.api.ret.SportsManAchievement;
import com.weishi.project.api.vo.SportManBestResultVo;
import com.weishi.project.api.vo.TrainingAchievementMaxVo;
import com.weishi.project.api.vo.TrainingAchievementTopVo;
import com.weishi.project.api.vo.TrainingDataVo;
import com.weishi.project.sport.trainingdata.vo.WaterRankingVO;
import com.weishi.project.training.domain.AchievementExcel;
import com.weishi.project.training.domain.TrainingAchievement;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * TrainingAchievementMapper接口
 */
public interface TrainingAchievementMapper extends BaseMapper<TrainingAchievement> {

    /**
     * 查询TrainingAchievement列表
     */
    List<TrainingAchievement> selectTrainingAchievementList(TrainingAchievement trainingAchievement);
    List<AchievementExcel> selectTrainingAchievementListExcel(TrainingAchievement trainingAchievement);
    List<TrainingAchievement> selectTrainingAchievementList1(TrainingAchievement trainingAchievement);

    List<Map<String, Object>> qryBestResultSpecialProject(SportManBestResultVo sportManBestResultVo);

    /**
     * 查询运动员训练成绩
     * @param params
     * @return
     */
    List<Map<String, Object>> qryTrainingDataInfoBySportManId(Map<String, Object> params);

    /**
     * 查询某次训练项目的所有运动员的训练成绩
     * @param id
     * @return
     */
    List<SportsManAchievement> qryTrainingAchievementByTrainingDayId(Integer id);

    /**
     * top10排名情况
     * @param params
     * @return
     */
    List<TrainingAchievementTopVo> qryTrainingAchievementTop(Map<String, Object> params);

    List<TrainingAchievementMaxVo> selectTrainingAchievementListByChannelId(int channelId);

    List<Map<String, Object>> selectClassHourBoatType(Map<String, Object> params);

    List<Map<String, Object>> selectKilometersBoatType(Map<String, Object> params);

    List<TrainingAchievement> trainingAchievementList(Map<String, Object> params);

    /**
     * 更新航道运动员成绩信息 service待定 参数见xml
     * @param trainingAchievement
     */
    void updateTrainingAchievement(TrainingAchievement trainingAchievement);

    /**
     * 删除之前有的成绩信息 添加新的
     */
    void deleteTrainingAchievement(TrainingAchievement trainingAchievement);

    /**
     * 保存成绩 真实成绩 或者说 更新成绩 没有保存成绩这一说 删除之前存在的 插入现有添加的
     */
    void saveTrainingAchievement(TrainingAchievement trainingAchievement);

    String selectSportsmanNameById(int sportsmanId);

    Map<String, Object> selectTrainingAchievementDetailedReport(Map<String, Object> params);

    List<Map<String, Object>> selectDetailedReportByParams(TrainingDataVo trainingDataVo);


    /**
     * 查询运动员水上专项训练--最好成绩排名
     */
    List<WaterRankingVO> getWaterRankingVO(@Param("userId")Integer userId , @Param("trainingMode")Integer trainingMode , @Param("kilometers")Integer kilometers , @Param("sex")Integer sex , @Param("realClassHour")Integer realClassHour);


    /**
     * 查询运动员水上专项训练--根据 运动员名称查询排名
     */
    List<WaterRankingVO> getWaterRankingNameVO(@Param("name")String name , @Param("trainingMode")Integer trainingMode, @Param("kilometers")Integer kilometers , @Param("sex")Integer sex , @Param("realClassHour")Integer realClassHour);


    /**
     * 查询运动员陆上专项训练--最好成绩排名
     */
    List<WaterRankingVO> getWaterRankingVOLU(@Param("userId")Integer userId, @Param("trainingMode")Integer trainingMode, @Param("kilometers")Integer kilometers , @Param("sex")Integer sex , @Param("realClassHour")Integer realClassHour);


    /**
     * 查询运动员陆上专项训练--根据 运动员名称查询排名
     */
    List<WaterRankingVO> getWaterRankingNameVOLU(@Param("name")String name , @Param("trainingMode")Integer trainingMode, @Param("kilometers")Integer kilometers , @Param("sex")Integer sex , @Param("realClassHour")Integer realClassHour);


    /**
     * 运动员 -- 今日专项成绩排名 第一次查询
     */
    List<WaterRankingVO> getThisDayRankingVO(@Param("groupId")Integer groupId , @Param("boatType")String boatType , @Param("trainingDayId")Integer trainingDayId , @Param("sex")Integer sex , @Param("trainingMode")Integer trainingMode , @Param("kilometers")Integer kilometers , @Param("realClassHour")Double realClassHour , @Param("firstLevel")String firstLevel);


    /**
     * 查询运动员专项训练--根据 运动员名称查询排名 第二次查询
     */
    List<WaterRankingVO> getThisDayRankingVOSS(@Param("groupId")Integer groupId , @Param("firstLevel")String firstLevel , @Param("name")String name , @Param("trainingMode")Integer trainingMode , @Param("kilometers")Integer kilometers , @Param("sex")Integer sex);


    void deleteTrainingAchievementByChannelId(Integer channelId);

    List<TrainingAchievementTopVo> qryTrainingAchievementTopGroupByBoat(Map<String, Object> params);


    /**
     * 根据成绩表查询今天参加的所有课程 id
     */
    List<Integer> getIdList(@Param("userId")Integer userId , @Param("day")String day);




}